import requests,json,zmq

context = zmq.Context.instance()
sock = context.socket(zmq.PUB)
sock.bind('tcp://0.0.0.0:9050')
while  True:
  try:
    url='http://tplogin.cn/stok=Q%24zfOz%3E%5E4H92s%08v%5Da.WLjHX%5DzxA2XW5S/ds'
    data={"hosts_info":{"table":"online_host"},"method":"get"}
    res=requests.post(url,data=json.dumps(data)).json()['hosts_info']
    sock.send(json.dumps(res))
    print '.'
  except Exception as e:
    raise(e)

